<template>
  <div class="app-container">

<!--    <el-table v-loading="loading" :data="TAboutUsInfoList" @selection-change="handleSelectionChange">-->
<!--      <el-table-column type="selection" width="55" align="center" />-->
<!--      <el-table-column label="数据主键" align="center" prop="id" />-->
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['pos:TAboutUsInfo:edit']"-->
<!--          >修改</el-button>-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['pos:TAboutUsInfo:remove']"-->
<!--          >删除</el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--    </el-table>-->

<!--    <pagination-->
<!--      v-show="total>0"-->
<!--      :total="total"-->
<!--      :page.sync="queryParams.pageNum"-->
<!--      :limit.sync="queryParams.pageSize"-->
<!--      @pagination="getList"-->
<!--    />-->

    <!-- 添加或修改平台设置（关于我们）对话框 -->
    <div>
      <el-form ref="form" :model="form" :rules="rules" >
        <el-form-item label="id" prop="id" v-show="false" >
          <el-input v-model="form.id" placeholder="id" />
        </el-form-item>
        <el-form-item label="平台logo图片">
          <imageUpload v-model="form.logoImg"/>
        </el-form-item>
        <el-form-item label="平台名称" prop="name">
          <el-input v-model="form.name" placeholder="请输入平台名称" />
        </el-form-item>
        <el-form-item label="客服电话" prop="phone">
          <el-input v-model="form.phone" placeholder="请输入客服电话" />
        </el-form-item>
        <el-form-item label="官网地址" prop="domainName">
          <el-input v-model="form.domainName" placeholder="请输入官网地址" />
        </el-form-item>
        <el-form-item label="联系邮箱" prop="postbox">
          <el-input v-model="form.postbox" placeholder="请输入联系邮箱" />
        </el-form-item>
        <el-form-item label="平台简介" prop="platformExplain">
          <el-input v-model="form.platformExplain" placeholder="请输入平台简介" />
        </el-form-item>
        <el-form-item label="终端购买提示" prop="buyHint">
          <el-input v-model="form.buyHint" placeholder="请输入终端购买提示" />
        </el-form-item>
        <el-form-item label="终端划回提示" prop="transferHint">
          <el-input v-model="form.transferHint" placeholder="请输入终端划回提示" />
        </el-form-item>
        <el-form-item label="终端划拨提示" prop="returnHint">
          <el-input v-model="form.returnHint" placeholder="请输入终端划拨提示" />
        </el-form-item>
        <el-form-item label="商户奖励规则">
          <editor v-model="form.awardExplain" :min-height="192"/>
        </el-form-item>
        <el-form-item label="平台公约">
          <editor v-model="form.platformPact" :min-height="192"/>
        </el-form-item>
        <el-form-item label="用户协议">
          <editor v-model="form.userAgreement" :min-height="192"/>
        </el-form-item>
        <el-form-item label="隐私政策">
          <editor v-model="form.userPrivacy" :min-height="192"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { listTAboutUsInfo, getTAboutUsInfo, delTAboutUsInfo, addTAboutUsInfo, updateTAboutUsInfo, exportTAboutUsInfo } from "@/api/pos/TAboutUsInfo";

export default {
  data() {
    return {
      // 遮罩层
      loading: true,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询平台设置（关于我们）列表 */
    getList() {
      listTAboutUsInfo(this.queryParams).then(response => {
        this.TAboutUsInfoList = response.rows;
        this.form = response.rows[0];
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateTAboutUsInfo(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addTAboutUsInfo(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },

  }
};
</script>
